package sctu.edu.java.year2016.team07.nieying.practice.dishizhang;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/6/1 0001.
 */
public class Dome {
    public static void main(String[] args){
        String a="a",b="b",c="c",d="d",e="e",apple="apple";
        List<String> list=new ArrayList<>();
            list.add(a);
            list.add(apple);
            list.add(b);
            list.add(apple);
        list.add(c);
        list.add(apple);
        list.add(d);
        list.add(apple);
        System.out.println(list);
        System.out.println("apple第一次出现的索引位子是: "+list.indexOf(apple));
        System.out.println("apple最后一次出现的索引位子是: "+list.lastIndexOf(apple));
        System.out.println("b第一次出现的索引位子是: "+list.indexOf(b));
        System.out.println("b最后一次出现的索引位置是: "+list.lastIndexOf(b));
    }
}
